from PyQt5.Qt import *

"""
绘图类有4个: QPixmap、QImage、QPicture、QBitmap
QPixmap: 绘图
QImage: 图片的像素级访问
QPicture: 绘图设备类，继承QPainter
QBitmap: 继承QPixmap, 提供了1bit深度的二值图像类
"""
class MyQWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("QPixmap")
        self.pix = QPixmap()
        self.lastPoint = QPoint()
        self.endPoint = QPoint()
        self.setup_ui()

    def setup_ui(self):
        self.resize(800, 500)
        self.pix = QPixmap(200, 400)
        self.pix.fill(Qt.red)

if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    window = MyQWidget()
    window.show()
    sys.exit(app.exec_())